Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents | Next

Selectively Displaying Video

Video digitizer components may support one of three methods of selectively displaying video on the screen of a Macintosh computer. The three methods are key colors, alpha channels, and blend masks. For a complete description of these techniques for selectively displaying video, see "About Video Digitizer Components," which begins on About Video Digitizer Components .

Your application can determine whether a video digitizer component supports selective video display by examining the component's digitizer information structure (described on The Digitizer Information Structure ). Specifically, the vdigType field indicates the type of blending supported by the digitizer. Applications can use the VDGetDigitizerInfo function (described on VDGetDigitizerInfo ) to retrieve a component's digitizer information structure.

Some video digitizer components support the use of key colors as a mechanism for selectively displaying video on the screen of a Macintosh computer. When a key color is active, the digitizer component replaces all screen occurrences of that color with the appropriate portion of the source video. Video digitizer components that support key colors provide a number of functions to applications. Those functions are described in this section.

Your applications can use the VDSetKeyColor , VDAddKeyColor , and VDSetKeyColorRange functions to set one or more key colors for a video digitizer component. The VDGetKeyColor , VDGetNextKeyColor , and VDGetKeyColorRange functions allow your application to retrieve information about the currently active key colors.

Alpha channels and blend masks work similarly to one another. Digitizer components that support alpha channels use a portion of each pixel value to indicate the degree of video display for that pixel. Digitizer components that support blend masks use the mask to indicate the degree of video display for corresponding pixels.

Your applications can use the VDGetMaskandValue function to determine the appropriate mask value for a desired blend level. The VDSetMasterBlendLevel function allows applications to set a blend level that applies to the entire source video image. The VDGetMaskPixMap function allows applications to retrieve the pixel map that defines the blend mask.

VDSetKeyColor

The VDSetKeyColor function allows applications to set the key color.

All video digitizer components that support key colors must support this function.

pascal VideoDigitizerError VDSetKeyColor
                                          (VideoDigitizerComponent ci,
                                         long index);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
index
Specifies the new key color. The value of the index field corresponds to a color in the current color lookup table.

DESCRIPTION

Some video digitizer components support multiple key colors. The VDSetKeyColor function instructs such digitizer components to clear the key color list and insert a single entry for the specified color. Applications can then use the VDAddKeyColor function, described on VDAddKeyColor , to place additional colors into the key color list.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

qtParamErr

-2202

Invalid parameter value

VDGetKeyColor

The VDGetKeyColor function allows your application to obtain the index value of the active key color.

All video digitizer components that support key colors must support this function.

pascal VideoDigitizerError VDGetKeyColor
                                          (VideoDigitizerComponent ci,
                                          long *index);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
index
Contains a pointer to a field that is to receive the index of the key color. This index value identifies the key color within the currently active color lookup table. If there are several active key colors, the video digitizer returns the first color from the key color list. Subsequently, applications use the VDGetNextKeyColor function (described on VDGetNextKeyColor ) to obtain other colors from the list. If there is no active key color, the VDGetKeyColor function sets the field to -1.

DESCRIPTION

In cases where there are several key colors, the VDGetKeyColor function always returns the index of the first color in the list. Applications should then use the VDGetNextKeyColor function (described on VDGetNextKeyColor ) to retrieve the remaining colors in the list.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

VDSetKeyColorRange

Some video digitizer components that support key colors may allow applications to set a range of key color values. The key color range is expressed as a range of RGB color values. The VDSetKeyColorRange function allows your application to define a key color range.

pascal VideoDigitizerError VDSetKeyColorRange
                                          (VideoDigitizerComponent ci,
                                          RGBColor *minRGB,
                                         RGBColor *maxRGB);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
minRGB
Contains a pointer to a field that contains the lower bound of the key color range. All colors in the color table between the color specified by the minRGB parameter and the color specified by the maxRGB parameter are considered key colors.
maxRGB
Contains a pointer to a field that contains the upper bound of the key color range. All colors in the color table between the color specified by the minRGB parameter and the color specified by the maxRGB parameter are considered key colors.

DESCRIPTION

If the digitizer component cannot accommodate all the colors that are defined in the specified range, it returns a result value of noMoreKeyColors .

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

noMoreKeyColors

-2205

Key color list is full

SEE ALSO

Your application can obtain the current key color range by calling the VDGetKeyColorRange function, which is described on VDGetKeyColorRange .

VDAddKeyColor

Some video digitizer components can support more than one active key color. The VDAddKeyColor function allows applications to add a key color to a component's list of active key colors.

pascal VideoDigitizerError VDAddKeyColor
                                          (VideoDigitizerComponent ci,
                                         long *index);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
index
Contains a pointer to the color to add to the key color list. The value of the index field corresponds to a color in the current color lookup table.

DESCRIPTION

If the digitizer component cannot accommodate any more key colors, it returns a result code of noMoreKeyColors .

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

qtParamErr

-2202

Invalid parameter value

noMoreKeyColors

-2205

Key color list is full

SEE ALSO

To ensure that the key color list contains only the desired colors, your application should use the VDSetKeyColor function (described on VDSetKeyColor ) to set the first key color.

VDGetKeyColorRange

Some video digitizer components that support key colors may allow applications to set a range of key color values. The key color range is expressed as a range of RGB color values. The VDGetKeyColorRange function allows applications to obtain the currently defined key color range.

pascal VideoDigitizerError VDGetKeyColorRange
                                          (VideoDigitizerComponent ci,
                                         RGBColor *minRGB,
                                         RGBColor *maxRGB);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
minRGB
Contains a pointer to a field that is to receive the lower bound of the key color range. The video digitizer component places the RGB color that corresponds to the lower end of the range in the field referred to by this parameter.
maxRGB
Contains a pointer to a field that is to receive the upper bound of the key color range. The video digitizer component places the RGB color that corresponds to the upper end of the range in the field referred to by this parameter.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

badCallOrder

-2209

Digitizer component not ready for this function

SEE ALSO

Your application can set the color range by calling the VDSetKeyColorRange function, which is described on VDSetKeyColorRange .

VDGetNextKeyColor

The VDGetNextKeyColor function allows your application to obtain the index value of the active key colors in cases where the digitizer component supports multiple key colors. Your application can use the VDGetKeyColor function (described on VDGetKeyColor ) to retrieve the first key color in the list. Subsequently, your application can call the VDGetNextKeyColor function to retrieve the other colors in the key color list.

All video digitizer components that support multiple key colors must support this function.

pascal VideoDigitizerError VDGetNextKeyColor
                                          (VideoDigitizerComponent ci,
                                          long index);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
index
Specifies a field that is to receive the index of the next key color. This index value identifies the key color within the currently active color lookup table. If there are no more colors left in the list, the digitizer component sets the field referred to by the index parameter to -1.

DESCRIPTION

The VDGetNextKeyColor function returns an index value of -1 when there are no more colors in the list.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

VDSetMasterBlendLevel

The VDSetMasterBlendLevel function allows your application to set the blend level value for the input video signal. This value applies to the entire source video image.

pascal VideoDigitizerError VDSetMasterBlendLevel
                                          (VideoDigitizerComponent ci,
                                         unsigned short *blendLevel);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
blendLevel
Contains a pointer to a field that specifies the new master blend level. Valid values range from 0 to 65,535, where 0 corresponds to no video and 65,535 corresponds to all video. The digitizer component returns the new value in this field, so your application can avoid using unsupported values in future requests.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

VDGetMaskandValue

The VDGetMaskandValue function allows your application to obtain the appropriate alpha channel or blend mask value for a desired level of video blending. Your application specifies a desired level of video blend.

pascal VideoDigitizerError VDGetMaskandValue
                                          (VideoDigitizerComponent ci,
                                          unsigned short blendLevel,
                                          long *mask, long *value);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
blendLevel
Specifies the desired blend level. Valid values range from 0 to 65,535, where 0 corresponds to no video and 65,535 corresponds to all video.
mask
Contains a pointer to a field that is to receive a value indicating which bits are meaningful in the data returned for the value parameter. The video digitizer component sets to 1 the bits that correspond to meaningful bits in the data returned for the value parameter.
value
Contains a pointer to a field that is to receive data that can be used to obtain the desired blend level. The data returned for the mask parameter indicates which bits are valid in the data returned for this parameter.

DESCRIPTION

The video digitizer returns the corresponding mask value. The application can then use this value to set the alpha channel or blend mask.

The information returned by the digitizer component differs based on the type of blending supported by the component. In all cases, however, the returned value of the value parameter contains the value for the desired blend level, and the returned value of the mask parameter indicates which bits in the value parameter are meaningful. Bits in the returned mask parameter value that are set to 1 correspond to meaningful bits in the returned value parameter value.

For example, if an application requests a 50 percent video blend level from a digitizer that supports 8-bit alpha channels, the digitizer component might return the following values:

mask

0xFF000000

Identifies full upper byte as the alpha channel

value

0x80000000

Value for 50 percent blend level

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

VDGetMaskPixMap

The VDGetMaskPixMap function allows applications to retrieve the pixel map data for a component's blend mask. This function is supported only by digitizer components that support blend masks.

pascal VideoDigitizerError VDGetMaskPixMap
                                          (VideoDigitizerComponent ci,
                                          PixMapHandle maskPixMap);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
maskPixMap
Contains a handle to a pixel map. The video digitizer component returns the pixel map data for its blend mask into the pixel map specified by this parameter. The video digitizer component resizes the handle as appropriate. Your application is responsible for disposing of this handle.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next